package com.naiterui.ehp.bs.patient.bo.notice;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

import com.naiterui.ehp.bs.patient.config.TemplateProperties;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 患者消息默认模板消息
 *
 * @author gaoliangliang
 * @date 2019-07-12 15:44
 * @since 1.0.0
 */
@Getter
@Setter
@ToString
@Builder
@AllArgsConstructor
public class OutlineMsg extends BaseNotice {

    private static final long serialVersionUID = -885243714876373783L;

    /**
     * 医生姓名
     */
    private String doctorName;
    /**
     * 患者姓名
     */
    private String patientName;
    /**
     * 消息预览
     */
    private String consultMsg;

    @Override
    public String getTemplateLabel() {
        return "OUTLINE";
    }

    @Override
    public void handleContent(List<TemplateProperties.Content> contentList) {
        Map<String, String> formatMap = new HashMap<>();
        formatMap.put("DOCTOR_FULL_NAME", this.getDoctorName());
        formatMap.put("PATIENT_NAME", this.getPatientName());
        formatMap.put("CONSULT_MSG", this.getConsultMsg());
        super.formatData(contentList, formatMap);
    }

    @Override
    public boolean validate() {
        if (super.validate() && StringUtils.isNotBlank(doctorName)) {
            return true;
        } else {
            return false;
        }
    }

}
